package com.SouthernWall_404.AgeRight.Common.Network.Packets.S2C.ClientHandler;

import com.SouthernWall_404.AgeRight.Common.API.Capability.Locks;
import com.SouthernWall_404.AgeRight.Common.API.Capability.Provider.LocksProvider;
import com.SouthernWall_404.AgeRight.Common.Network.Packets.S2C.LockS2CPack;
import net.minecraft.client.Minecraft;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraftforge.network.NetworkEvent;

import java.util.function.Supplier;

public class LocksClientHandler {

    //private static MusicBlockInfo existingSetting=new MusicBlockInfo();



    public static void hanlder(LockS2CPack msg, Supplier<NetworkEvent.Context> ctx)
    {
        Level level=Minecraft.getInstance().level;
        LevelChunk levelChunk=level.getChunk(msg.chunkPos.x,msg.chunkPos.z);

        Locks locks=levelChunk.getCapability(LocksProvider.LOCKS).orElse(null);
        if(locks!=null)
        {
            locks.deserializeNBT(msg.modPack);
        }


    }

}
